﻿<%@ Page CodeFileBaseClass="AliCMS.Lib.SystemPageBase" %>
<script language="c#" runat="server">
protected bool CanAdd(DataRow record)
{
	if (Guid.Equals(record[Alias.Module.ID], new Guid("{60E576FB-24BF-4CFA-8756-F69D4C13FE46}")))
		return false;
		
	return true;
}

protected string HasSubInstance(object ns)
{
	DataRow[] rows = Manager.Objects.Select(Alias.Module.Object.Namespace + "='" + ns + "' and " + Alias.Module.Object.Name + "='SubInstance'");
	if (rows.Length > 0)
		return "true";
	else
		return "false";
}
</script>
<section data-page="instance_add" data-title="添加实例" data-lang="<%=ContentLang%>">
	<dl class="path1">
		<dt><span>您的位置：</span>添加实例</dt>
		<dd>
			<select data-class="<%=ContentLang%>Font" data-ali-widget="combo">
				<ali:List Object="Language" Source="Manager.Languages">
					<ali:Record>
						<%If Convert.ToString(Ab) == ContentLang%>
							<option value="<%=Ab%>" selected><%=[AliCMS.SystemModule.Alias.Language.Name + PageLang]%></option>
						<%Else%>
							<option value="<%=Ab%>"><%=[AliCMS.SystemModule.Alias.Language.Name + PageLang]%></option>
						<%EndIf%>
					</ali:Record>
				</ali:List>
			</select>
		</dd>
	</dl>
	<form action="" class="post">
		<div class="post-body">
			<div class="ali-tabs" data-event="click">
				<div class="ali-tabs-header">
					<div class="ali-tabs-nav-container">
						<ul>
							<li><a href="list.aspx?Lang=<%=ContentLang%>" target="ali-navtab">实例列表</a></li>
							<li class="ali-active"><a>添加实例</a></li>
						</ul>				
					</div>
				</div>
				<div class="ali-tabs-body">
					<div class="ali-tabs-panel"></div>
					<div class="ali-tabs-panel">
						<table class="post-table margin2">
							<tr>
								<th>模块：</th>
								<td>
									<select name="ModuleID" data-class="<%=ContentLang%>Font" data-ali-widget="combo">
										<ali:List Object="Module">
											<ali:Record>
												<%If CanAdd(Record)%>
													<option value="<%=ID%>" data-has-sub-instance="<%=HasSubInstance(Namespace)%>"><%=Label%></option>
												<%EndIf%>
											</ali:Record>
										</ali:List>
									</select>
								</td>
							</tr>
							<tr>
								<th>名称：</th>
								<td><input type="text" name="Name" maxlength="50" class="ali-input <%=ContentLang%>Font"></td>
							</tr>
							<tr>
								<th>数据库提供者：</th>
								<td>
									<select name="DatabaseProvider" data-class="<%=ContentLang%>Font" data-ali-widget="combo">
										<option value="OleDb">OleDb</option>
									</select>
								</td>
							</tr>
							<tr>
								<th>连接字符串：</th>
								<td>
									<input type="text" name="ConnectionString" size="60" maxlength="255" class="ali-input">
									<br>{#WebPath#}表示网站根目录，{#DataPath#}表示数据库目录
								</td>
							</tr>
							<tr data-name="IsMultiUserRow" style="display:none">
								<th>多用户：</th>
								<td>
									<label><input type="radio" name="IsMultiUser" value="true">是</label>
									<label><input type="radio" name="IsMultiUser" value="false" checked>否</label>
								</td>
							</tr>
						</table>
					</div>
				</div>
				<div class="ali-tabs-bottom"><b></b></div>
			</div>
		</div>
		<div class="post-footer"><button type="submit" class="ali-button">添 加</button></div>
	</form>
</section>